\appendix
\chapter{Enclosed CD contents}
	\begin{figure}[h]				
		\mbox{\includegraphics{images/cd-contents.jpg}}		
		\caption{Contents of the enclosed CD.}
		\label{fig:cdcontents}
	\end{figure}
In figure \ref{fig:cdcontents} we can see the content of the enclosed 
CD in explorer. The CD contains this document in the \emph{doc} folder. 
Everything that is needed to install Patterns4Net is in the 
\emph{install} folder: it contains Graphviz installer and .NET framework 
version 4.0 installer. 
The \emph{source} folder contains the source code of Patterns4Net and 
all libraries needed to build it. If the .NET framework is installed 
on the hard drive C, batch scripts \emph{go.bat} and {release.bat} 
will build the sources, otherwise they need to be edited and the valid 
path to the MSBuild must be provided. The \emph{go.bat} script builds 
the sources and runs unit tests. The \emph{release.bat} script builds the 
sources and creates patterns4net release in 
the \emph{integration\textbackslash{}release} folder. 
The \emph{example} folder 
contains full source code of Pattern Enforcer example discussed in 
this document and an example of source code prepared to be 
visualized by Architecture Explorer.

\chapter{Installation}
Patterns4Net depends on the Graphviz tool and .NET framework version 4.0, 
installers of this software can be found on the enclosed CD.

Patterns4Net itself does not require classical installation, 
instead the \emph{patterns4net} folder, which contains all the binaries and 
default configuration files, can be just copied to hard drive. However, 
in order to save configuration file, Architecture Explorer needs access 
rights for a folder with configuration.

\chapter{List of patterns supported by Pattern Enforcer}
\label{app:patternslist}
In this list we informally describe structural aspects that are 
enforced by Pattern Enforcer. Formal specification expressed in 
Pattern Enforcer constraints specification API, can be found 
in the source code.
\begin{itemize}
	\item{Composite}
		\begin{itemize}
			\item{} The Composite class should implement the Component interface.
			\item{} The Composite class should contain a collection of 
			Component objects as a field.
			\item{} Each method of the Composite class should use the 
			collection of Component objects either in a loop, or as a 
			parameter for Linq extension method.
		\end{itemize}
	\item{Factory Method}
		\begin{itemize}
			\item{} The type that declares the method should not be sealed.
			\item{} The method should be virtual.
			\item{} The method should not be void.
		\end{itemize}		
	\item{Immutable}
		\begin{itemize}
			\item{} The Immutable object should not allow to change it's 
			internal state once it is accessible to other objects.
			\item{} When the pattern option Deep is set to true, 
				all objects that are contained in the Immutable object, 
				must be also Immutable.
		\end{itemize}		
	\item{Null Object}
		\begin{itemize}
			\item{} The class that implements Null Object should implement 
			some interface or inherit from another class different from Syste.Object.
			\item{} All methods that can be overridden should be overridden.
			\item{} Void methods has empty body and non-void methods contain 
			only return statement with constant value.
		\end{itemize}	
	\item{Prototype}
		\begin{itemize}
			\item{} The Prototype class implements IColeable interface.
		\end{itemize}		
	\item{Adapter}
		\begin{itemize}
			\item{} If the Adaptee role is set, then 
			the Adapter class should contain field of type Adaptee.
			\item{} If the Target role is set, then 
			the Adapter should implement or inherit the Target interface or class.
		\end{itemize}				
	\item{Bridge}
		\begin{itemize}
			\item{} If the WrappedType role is set, then 
			the Bridge class should contain field of this type.
			\item{} If the Implementor role is set, then 
			the Bridge should implement or inherit the Implementor interface or class.
		\end{itemize}
	\item{Proxy}
		\begin{itemize}
			\item{} If the RealSubject role is set, then 
			the Proxy class should contain field of type RealSubject.
			\item{} If the Subject role is set, then 
			the Proxy should implement or inherit the Subject interface or class.
			\item{} If both roles are set, then RealSubject should 
			implement or inherit from Subject.
		\end{itemize}	
	\item{Decorator}
		\begin{itemize}
			\item{} If the Decorated role is set, then 
			the Decorator class should contain field of this type and at the 
			same time implement or inherit from the Decorated interface or class.
		\end{itemize}	
	\item{Simple Factory Method}
		\begin{itemize}
			\item{} The method should not be void.
		\end{itemize}	
	\item{Singleton}
		\begin{itemize}
			\item{} The class should implement exactly one of the 
			Singleton implementations described in \cite{singleton-cis:Online}.
		\end{itemize}	
	\item{Strategy}
		\begin{itemize}
			\item{} The Strategy should be non-sealed class or interface.
			\item{} The Strategy should contain exactly one method, 
			which should be virtual.
		\end{itemize}		
	\item{Template Method}
		\begin{itemize}
			\item{} The type that declares the Template Method should not be sealed.
			\item{} The Template Method should not be virtual.
			\item{} The Template Method should invoke at least one 
			virtual method or another Template Method.
		\end{itemize}	
	\item{Visitor} \emph{The Visitor may be implemented using 
	Reflection, in such case nothing is enforced. The VisiteableElementsRoot  
	role represents the base class or interface of for all elements that the 
	Visitor can visit. If this role is set, then:}
		\begin{itemize}			
			\item{} Each sub-class C of VisiteableElementsRoot should define a 
			method that has the Visitor as one of it's parameters and in 
			the body it should invoke a Visitor's 
			methods that takes C as a parameter 
			supplying it itself as 
			the parameter actual value.
		\end{itemize}		
\end{itemize}

\chapter{XML Schemas}
\label{app:xsd}
\section*{Pattern Enforcer configuration}
\begin{minted}[bgcolor=codebg, fontsize=\footnotesize]{xml}
<!-- file: pattern-enforcer-types.xsd -->
<!-- Defines types for pattern-enforcer-config and for 
  architecture-explorer-config schemas -->
<?xml version="1.0" encoding="utf-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:complexType name="Config">
    <xs:annotation>
      <xs:documentation>
        The root element of Pattern Enforcer configuration.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="plugins" type="AssembliesList" 
	      minOccurs="0" maxOccurs="1"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="AssembliesList">
    <xs:annotation>
      <xs:documentation>
        The list of assemblies that will be loaded 
		as plugins into Pattern Enforcer. 
        These assemblies are expected to contain 
		custom design patterns definitions and 
        plugins registered via MEF.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="assembly" type="Assembly" 
	      minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="Assembly">
    <xs:annotation>
      <xs:documentation>
        Assembly with patterns definitions or pluging. 
        The filename attribute can be either full path, 
        or relative to the directory from which 
        Pattern Enforcer was run. 
      </xs:documentation>
    </xs:annotation>    
    <xs:attribute name="filename" use="required" type="xs:string"/>
  </xs:complexType>
</xs:schema>
\end{minted}
\\
\begin{minted}[bgcolor=codebg, fontsize=\footnotesize]{xml}
<!-- file: pattern-enforcer-config.xsd -->
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:include schemaLocation="pattern-enforcer-types.xsd"/>
  
  <xs:element name="config" type="Config">    
  </xs:element>
</xs:schema>
\end{minted}

\section*{Architecture Explorer configuration}
\begin{minted}[bgcolor=codebg, fontsize=\footnotesize]{xml}
<!-- file: architecture-explorer-config.xsd -->
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:include schemaLocation="pattern-enforcer-types.xsd"/>

  <xs:element name="config" type="ArchitectureExplorerConfig"/>
    
  <xs:complexType name="ArchitectureExplorerConfig">
    <xs:annotation>
      <xs:documentation>
        The root element of Architecture Explorer configuration, 
		which is an extension to Pattern Enforcer configuration.
      </xs:documentation>
    </xs:annotation>

    <xs:complexContent>
      <xs:extension base="Config"> <!-- Pattern Enforcer Config type -->
        <xs:sequence>
          <xs:element name="ignore-namespaces" type="NamespacesIgnoreList" 
		      nillable="false" maxOccurs="1"/>
          <xs:element name="ignore-types" type="TypesIgnoreList" 
		      nillable="false" maxOccurs="1"/>
		  <xs:element name="ignore-members" type="MembersIgnoreList" 
		      nillable="false" maxOccurs="1"/>
          <xs:element name="dot" nillable="false" maxOccurs="1">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="graph-attributes" type="DotAttributesList" 
				    nillable="false" maxOccurs="1"/>
              </xs:sequence>
            </xs:complexType>
          </xs:element> 
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="NamespacesIgnoreList">
    <xs:annotation>
      <xs:documentation>
        The list of beginnings of namespaces that 
		should be ignored during the reverse engineering. 
        If Architecture Explorer finds a namespace that 
		starts with one of these strings, it will ignore it. 
        No wildcars are supported.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="namespace" type="xs:string" 
	      minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>
\end{minted}

\begin{minted}[bgcolor=codebg, fontsize=\footnotesize]{xml}
  <!-- file: pattern-enforcer-config.xsd 
  (continues from previous page) -->
  <xs:complexType name="TypesIgnoreList">
    <xs:annotation>
      <xs:documentation>
        The list of regular expressions for matching 
		names of types that should be ignored during 
		the reverse engineering. Remember that 
		use of dot '.' must be escaped.
        If Architecture Explorer finds a type 
		that matches one these expressions, 
        it will ignore it.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="type" type="xs:string" 
	      minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="MembersIgnoreList">
    <xs:annotation>
      <xs:documentation>
        The list of regular expressions for matching 
		names of members (properties, methods, field, etc.)
        that should be ignored during the reverse engineering.
        Remember that use of dot '.' must be escaped.
        If Architecture Explorer finds a member that 
		matches one these expressions, it will ignore it.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="member" type="xs:string" 
	      minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="DotAttributesList">
    <xs:annotation>
      <xs:documentation>
        The list of key-value pairs. 
		These will be added to the input file 
        for the Graphviz as graph attributes. 
        For more information about supported 
		attributes, see the DOT documentation.
      </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="attribute" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:attribute name="name" type="xs:string" use="required"/>
          <xs:attribute name="value" type="xs:string" use="required"/>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>  
</xs:schema>
\end{minted}

\section*{Patterns documentation}
\begin{minted}[bgcolor=codebg, fontsize=\footnotesize]{xml}
<!-- file: patterns-description.xsd -->
<!-- Defines format of patterns documentation that 
  is compatible with .NET API doc format. -->
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:element name="description" type="description-type"/>
  
  <xs:complexType name="description-type">
    <xs:sequence>
      <xs:element name="content" minOccurs="1" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="summary" type="summary-type" 
			    minOccurs="1" maxOccurs="1"/>
            <xs:element name="remarks" type="remarks-type" 
			    minOccurs="0" maxOccurs="1"/>            
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="sources" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="source" type="xs:string" 
			     maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="remarks-type" mixed="true">
    <xs:complexContent>
      <xs:extension base="content-type">
        <xs:sequence>
          <xs:element minOccurs="1" maxOccurs="unbounded" 
		       name="para" type="para-type"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="summary-type" mixed="true">
    <xs:complexContent>
      <xs:extension base="content-type">
        <xs:sequence>
          <xs:element minOccurs="0" maxOccurs="unbounded" 
		       name="para" type="para-type"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
\end{minted}

\begin{minted}[bgcolor=codebg, fontsize=\footnotesize]{xml}
  <!-- file: patterns-description.xsd 
    (continues from previous page) -->
  <xs:complexType name="content-type" mixed="true">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element minOccurs="0" maxOccurs="unbounded" 
		    name="c" type="c-type"/>
        <xs:element minOccurs="0" maxOccurs="unbounded" 
		    name="code" type="code-type"/>
        <xs:element minOccurs="0" maxOccurs="unbounded" 
		    name="list" type="list-type"/>
      </xs:choice>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="para-type" mixed="true">
    <xs:complexContent>
      <xs:extension base="content-type" />
    </xs:complexContent>
  </xs:complexType>
  
  <xs:complexType name="c-type" mixed="true">
  </xs:complexType>

  <xs:complexType name="code-type" mixed="true">
    <xs:attribute name="language" use="optional" 
	    type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="list-type">
    <xs:sequence>
      <xs:element name="listheader" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="term" type="xs:string" 
			   minOccurs="0" />
            <xs:element name="description" 
			   type="xs:string" minOccurs="0" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="item" minOccurs="0" 
	      maxOccurs="unbounded">
        <xs:complexType mixed="true">
          <xs:sequence>
            <xs:element name="term" type="xs:string" 
			   minOccurs="0" />
            <xs:element name="description" 
			   type="xs:string" minOccurs="0" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="type" type="xs:string" />
  </xs:complexType>
</xs:schema>
\end{minted}
\\
\begin{minted}[bgcolor=codebg, fontsize=\footnotesize]{xml}
<!-- file: patterns.xsd -->
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:include schemaLocation="pattern-description.xsd"/>  
  
  <xs:simpleType name="abstraction-level">
    <xs:restriction base="xs:string">
      <xs:enumeration value="low"/>
      <xs:enumeration value="higher"/>
      <xs:enumeration value="normal"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:complexType name="pattern-type">
    <xs:sequence>
      <xs:element name="class" minOccurs="1" maxOccurs="1">
        <xs:complexType>
          <xs:attribute name="full-name" 
		      type="xs:string" use="required" />
        </xs:complexType>
      </xs:element>
      <xs:element name="level" type="abstraction-level" 
	      minOccurs="0" maxOccurs="1"/>
      <xs:element name="description" minOccurs="1" 
	      maxOccurs="1" type="description-type"/>
    </xs:sequence>
  </xs:complexType>

  <xs:element name="patterns">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="pattern" maxOccurs="unbounded" 
		    type="pattern-type">
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
\end{minted}
